<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>资费下单</title>
	<link rel="stylesheet" type="text/css" href="__PUBLIC__/Public/css/tariff.css">
    <script src="__PUBLIC__/Public/js/jquery.min.1.11.3.js"></script>
    <style type="text/css">
        .box td:nth-child(7){
            width: 200px;
            padding:5px 10px ;
            text-align: left;
            line-height: 20px;
            font-size: 14px;
        }
       .box .announ{
           height: 100px;
           width: 100%;
           overflow: scroll;
       }
    </style>
</head>
<body>
	<div class="head">
		<div class="head_con">
			<h4>继续使用运价查询系统：</h4>
			<div>
				<table >
					<tr>
						<td colspan="3">
							<span>目的地：</span>
							<select name="country_id" id="country_id"  style="width:200px">
                                <foreach name="sta" item="value">
								<option value="<!--{$value['id']}-->"><!--{$value["ename"]}-->&nbsp;&nbsp;<!--{$value["cname"]}--></option>
                                </foreach>
							</select>
						</td>
					</tr>
					<tr>
						<td>
							<span>重量：</span>
							<input type="number" step="0.01" name="weight" id="weight" value='' style="width:100px" required="">KG
						</td>
						<!--<td>
							<span>类型：</span>
							<select name="type" >
								<option value="1">包裹</option>
                                <option value="0">文件</option>
							</select>
						</td>-->
						<td>
							<!--<span>渠道：</span>
							<select name="channel_id" id="channel_id">
								<option value="">请选择渠道</option>
                                <foreach name="chan" item="val">
								<option value="&lt;!&ndash;{$val['id']}&ndash;&gt;">&lt;!&ndash;{$val["company"]}&ndash;&gt;</option>
                                </foreach>
							</select>-->
						</td>
					</tr>
					<tr>
						<td colspan="3">
                            <a class="button fl green count" href="javascript:void(0);" id="tariff">运费计算</a>
							<a href="/" style="clear:both;">返回主页</a>
						</td>
					</tr>
				</table>
			</div>

		</div>
	</div>
	<div class="title"></div>
	<div class="box" style="min-height: 750px">
		<table>
			<tr>
				<th>目的地</th>
				<th>渠道</th>
				<th>时效</th>
				<th>重量(kg)</th>
				<th>价格(RBM)</th>
				<th>计费方式</th>
                <th>注意事项</th>
				<th>操作</th>
			</tr>
            <if condition="$arr==false">
                <tr class="data">
                    <td colspan="8">该暂时没有数据，请联系客服咨询</td>
                </tr>
            <else/>
            <foreach name="arr" item="val">
			<tr class="data">
				<td><!--{$val['cname']}--><!--{$val['ename']}--></td>
				<td><!--{$val['company']}--></td>
                <td><!--{$val['']}--></td>
				<td><!--{$val['weight']}--></td>
				<td><!--{$val['price']}--></td>
				<td><!--{$val['']}--></td>
				<td><div class="announ"><!--{$val['announcements']}--></div></td>
				<td>
					<a class="button green" href="/personage/waybill/cid/<!--{$val['country_id']}-->/qid/<!--{$val['channel_id']}-->">去下单</a>
				</td>
			</tr>
            </foreach>
            </if>
		</table>
	</div>

	<script type="text/javascript">
        $(function(){
            $("#tariff").click(function(){
                var weight= $("#weight").val();
                var country=$("#country_id").val();
                var channel= $("#channel_id").val();
                if(weight==false){
                    alert("重量只能输入数据");
                    return false;
                }
                $.getJSON("/tariff/ajax_tariff",{country_id:country,weight:weight,channel_id:channel},function(msg){
                    if(!$.isEmptyObject(msg)){
                        $("table tr.data").remove();
                        var chi ="";
                        for(var val in msg){
                            chi+="<tr class='data'><td>"+msg[val].cname+"&nbsp;&nbsp;"+msg[val].ename+"</td><td>"+msg[val].company+"</td><td>"+msg[val].prenscription+"</td>";
                            chi+="<td>"+msg[val].weight+"</td><td>"+msg[val].price+"</td><td>"+msg[val].method+"</td><td><div class='announ'>"+msg[val].announcements+"</div></td>";
                            chi+="<td><a class=\"button green\" href=\"/personage/waybill/cid/"+msg[val].country_id+"/qid/"+msg[val].channel_id+"\">去下单</a></td>";
                        }
                        $(chi).appendTo('.box table');
                    }else{
                        $("table tr.data").remove();
                        $("<tr class='data'><td colspan='8'>该国家暂时没有数据，请联系客服咨询</td></tr>").appendTo('.box table');
                    }
                })
            })
        })

	</script>
</body>
</html>
